import java.math.BigDecimal;

/**
 * @author zhu_shuai
 * @since 2021/5/31
 */
public class Demo1jvmmemory {
    public static void main(String[] args) {
        long totalMemory = Runtime.getRuntime().totalMemory();
        long maxMemory = Runtime.getRuntime().maxMemory();
        // 服务器内存 1/16
        System.out.println("总内存：" + new BigDecimal(totalMemory).divide(new BigDecimal(1024*1024)));
        // 服务器内存 1/4
        System.out.println("最大内存：" + new BigDecimal(maxMemory).divide(new BigDecimal(1024*1024)));
    }
}
